/*     */ package com.newcrm.util;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.net.URLEncoder;
/*     */ import java.util.Date;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.jsoup.Connection;
/*     */ import org.jsoup.Connection.Method;
/*     */ import org.jsoup.Connection.Response;
/*     */ import org.jsoup.Jsoup;
/*     */ 
/*     */ public class PhoneBoxUtil
/*     */ {
/*  22 */   private static Logger logger = Logger.getLogger(PhoneBoxUtil.class
/*  23 */     .getName());
/*     */ 
/*     */   public static String getCallLog(String voipServerUrl, String companyId2, String password, String seatNum, String tel, Date startDate, Date endDate, int minTime, int maxTime, int offset)
/*     */   {
/*  43 */     String date = Util.date2Str(new Date());
/*  44 */     String sign = MD5.getMD5(companyId2 + "_qikebao_box_" + date);
/*     */ 
/*  46 */     if (seatNum == null) {
/*  47 */       seatNum = "";
/*     */     }
/*  49 */     if (tel == null)
/*  50 */       tel = "";
/*     */     try
/*     */     {
/*  53 */       String url = voipServerUrl + "/callRecord?companyId2=" + 
/*  54 */         URLEncoder.encode(companyId2, "UTF-8") + "&password=" + 
/*  55 */         URLEncoder.encode(password, "UTF-8") + "&sign=" + 
/*  56 */         URLEncoder.encode(sign, "UTF-8") + "&date=" + 
/*  57 */         URLEncoder.encode(date, "UTF-8") + "&seatNum=" + 
/*  58 */         URLEncoder.encode(seatNum, "UTF-8") + "&tel=" + 
/*  59 */         URLEncoder.encode(tel, "UTF-8") + "&offset=" + offset + 
/*  60 */         "&start=" + 
/*  61 */         URLEncoder.encode(Util.date2Str2(startDate), "UTF-8") + 
/*  62 */         "&end=" + 
/*  63 */         URLEncoder.encode(Util.date2Str2(endDate), "UTF-8") + 
/*  64 */         "&minTime=" + minTime + "&maxTime=" + maxTime + "&rnd=" + 
/*  65 */         Util.random(13);
/*     */ 
/*  69 */       Connection.Response response = Jsoup.connect(url).userAgent("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET CLR 1.1.4322; .NET4.0C)")
/*  70 */         .timeout(10000).method(Connection.Method.GET).execute();
/*     */ 
/*  72 */       return response.body();
/*     */     } catch (IOException e) {
/*  74 */       logger.warn("get voip call info failed", e);
/*     */     }
/*     */ 
/*  77 */     return null;
/*     */   }
/*     */ 
/*     */   public static String getSeatReport(String companyId2, String password, int minTotalTime, int maxTotalTime, String startDate, String endDate)
/*     */   {
/*  94 */     String date = Util.date2Str(new Date());
/*  95 */     String sign = MD5.getMD5(companyId2 + "_qikebao_box_" + date);
/*     */     try
/*     */     {
/*  98 */       String url = "http://box.qikebao.com/chart?type=seat&startDate=" + 
/*  99 */         URLEncoder.encode(startDate, "UTF-8") + "&endDate=" + 
/* 100 */         URLEncoder.encode(endDate, "UTF-8") + "&minTotalTime=" + 
/* 101 */         minTotalTime + "&maxTotalTime=" + maxTotalTime + 
/* 102 */         "&companyId2=" + URLEncoder.encode(companyId2, "UTF-8") + 
/* 103 */         "&password=" + URLEncoder.encode(password, "UTF-8") + 
/* 104 */         "&sign=" + URLEncoder.encode(sign, "UTF-8") + "&date=" + 
/* 105 */         URLEncoder.encode(date, "UTF-8") + "&rnd=" + 
/* 106 */         Util.random(13);
/*     */ 
/* 110 */       Connection.Response response = Jsoup.connect(url).userAgent("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET CLR 1.1.4322; .NET4.0C)")
/* 111 */         .timeout(10000).method(Connection.Method.GET).execute();
/*     */ 
/* 113 */       return response.body();
/*     */     } catch (IOException e) {
/* 115 */       logger.warn("get voip call info failed", e);
/*     */     }
/*     */ 
/* 118 */     return null;
/*     */   }
/*     */ 
/*     */   public static String getAreaReport(String companyId2, String password, int minTotalTime, int maxTotalTime, String seatNum, String startDate, String endDate)
/*     */   {
/* 137 */     String date = Util.date2Str(new Date());
/* 138 */     String sign = MD5.getMD5(companyId2 + "_qikebao_box_" + date);
/*     */ 
/* 140 */     if (seatNum == null) {
/* 141 */       seatNum = "";
/*     */     }
/* 143 */     if (startDate == null) {
/* 144 */       startDate = "";
/*     */     }
/* 146 */     if (endDate == null) {
/* 147 */       endDate = "";
/*     */     }
/*     */     try
/*     */     {
/* 151 */       String url = "http://box.qikebao.com/chart?type=area&startDate=" + 
/* 152 */         URLEncoder.encode(startDate, "UTF-8") + "&endDate=" + 
/* 153 */         URLEncoder.encode(endDate, "UTF-8") + "&minTotalTime=" + 
/* 154 */         minTotalTime + "&maxTotalTime=" + maxTotalTime + 
/* 155 */         "&companyId2=" + URLEncoder.encode(companyId2, "UTF-8") + 
/* 156 */         "&password=" + URLEncoder.encode(password, "UTF-8") + 
/* 157 */         "&seatNum=" + URLEncoder.encode(seatNum, "UTF-8") + 
/* 158 */         "&sign=" + URLEncoder.encode(sign, "UTF-8") + "&date=" + 
/* 159 */         URLEncoder.encode(date, "UTF-8") + "&rnd=" + 
/* 160 */         Util.random(13);
/*     */ 
/* 164 */       Connection.Response response = Jsoup.connect(url).userAgent("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; .NET CLR 1.1.4322; .NET4.0C)")
/* 165 */         .timeout(10000).method(Connection.Method.GET).execute();
/*     */ 
/* 167 */       return response.body();
/*     */     } catch (IOException e) {
/* 169 */       logger.warn("get voip call info failed", e);
/*     */     }
/*     */ 
/* 172 */     return null;
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.util.PhoneBoxUtil
 * JD-Core Version:    0.6.1
 */